package com.otp.webapp.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.appfuse.model.LabelValue;
import org.appfuse.util.ConvertUtil;

import com.otp.model.test.template.Attribute;
import com.otp.model.test.template.AttributeValue;

public class SelectMenuDemographics {

	private Attribute attribute;
	private List<AttributeValue> attributeValues = new ArrayList<AttributeValue>();  
	private String description;
	private String selection;
	private Map<String, String> menuData;
	
	public Attribute getAttribute() {
		return attribute;
	}
	public void setAttribute(Attribute attribute) {
		this.attribute = attribute;
	}
	public List<AttributeValue> getAttributeValues() {
		return attributeValues;
	}
	public void setAttributeValues(List<AttributeValue> attributeValues) {
		this.attributeValues = attributeValues;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getSelection() {
		return selection;
	}
	public void setSelection(String selection) {
		this.selection = selection;
	}
	public Map<String, String> getMenuData() {
		return menuData;
	}
	public void setMenuData(Map<String, String> menuData) {
		this.menuData = menuData;
	}
	
	public SelectMenuDemographics(Attribute attribute, List<AttributeValue> values){
		this.attribute = attribute;
		this.attributeValues =values; 
		description = attribute.getDescription();
		List<LabelValue> temps = new ArrayList<LabelValue>();
		for(AttributeValue val:values) temps.add(new LabelValue(val.getName(),val.getObjectId().toString()));
		menuData = ConvertUtil.convertListToMap(temps);
	}
}
